\(\int \frac {A+B x^2}{a-b x^2} \, dx\) [116]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 18, antiderivative size = 39 \[ \int \frac {A+B x^2}{a-b x^2} \, dx=-\frac {B x}{b}+\frac {(A b+a B) \text {arctanh}\left (\frac {\sqrt {b} x}{\sqrt {a}}\right )}{\sqrt {a} b^{3/2}} \]

[Out]

-B*x/b+(A*b+B*a)*arctanh(x*b^(1/2)/a^(1/2))/b^(3/2)/a^(1/2)

Rubi [A] (verified)

Time = 0.02 (sec) , antiderivative size = 39, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.111, Rules used = {396, 214} \[ \int \frac {A+B x^2}{a-b x^2} \, dx=\frac {(a B+A b) \text {arctanh}\left (\frac {\sqrt {b} x}{\sqrt {a}}\right )}{\sqrt {a} b^{3/2}}-\frac {B x}{b} \]

[In]

Int[(A + B*x^2)/(a - b*x^2),x]

[Out]

-((B*x)/b) + ((A*b + a*B)*ArcTanh[(Sqrt[b]*x)/Sqrt[a]])/(Sqrt[a]*b^(3/2))

Rule 214

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[-a/b, 2]/a)*ArcTanh[x/Rt[-a/b, 2]], x] /; FreeQ[{a, b},
x] && NegQ[a/b]

Rule 396

Int[((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Simp[d*x*((a + b*x^n)^(p + 1)/(b*(n*(
p + 1) + 1))), x] - Dist[(a*d - b*c*(n*(p + 1) + 1))/(b*(n*(p + 1) + 1)), Int[(a + b*x^n)^p, x], x] /; FreeQ[{
a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && NeQ[n*(p + 1) + 1, 0]

Rubi steps \begin{align*} \text {integral}& = -\frac {B x}{b}+\frac {(A b+a B) \int \frac {1}{a-b x^2} \, dx}{b} \\ & = -\frac {B x}{b}+\frac {(A b+a B) \tanh ^{-1}\left (\frac {\sqrt {b} x}{\sqrt {a}}\right )}{\sqrt {a} b^{3/2}} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.01 (sec) , antiderivative size = 39, normalized size of antiderivative = 1.00 \[ \int \frac {A+B x^2}{a-b x^2} \, dx=-\frac {B x}{b}+\frac {(A b+a B) \text {arctanh}\left (\frac {\sqrt {b} x}{\sqrt {a}}\right )}{\sqrt {a} b^{3/2}} \]

[In]

Integrate[(A + B*x^2)/(a - b*x^2),x]

[Out]

-((B*x)/b) + ((A*b + a*B)*ArcTanh[(Sqrt[b]*x)/Sqrt[a]])/(Sqrt[a]*b^(3/2))

Maple [A] (verified)

Time = 2.54 (sec) , antiderivative size = 37, normalized size of antiderivative = 0.95

method result size
default \(-\frac {B x}{b}-\frac {\left (-A b -B a \right ) \operatorname {arctanh}\left (\frac {b x}{\sqrt {a b}}\right )}{b \sqrt {a b}}\) \(37\)
risch \(-\frac {B x}{b}-\frac {\ln \left (b x -\sqrt {a b}\right ) A}{2 \sqrt {a b}}-\frac {\ln \left (b x -\sqrt {a b}\right ) B a}{2 b \sqrt {a b}}+\frac {\ln \left (-b x -\sqrt {a b}\right ) A}{2 \sqrt {a b}}+\frac {\ln \left (-b x -\sqrt {a b}\right ) B a}{2 b \sqrt {a b}}\) \(99\)

[In]

int((B*x^2+A)/(-b*x^2+a),x,method=_RETURNVERBOSE)

[Out]

-B*x/b-(-A*b-B*a)/b/(a*b)^(1/2)*arctanh(b*x/(a*b)^(1/2))

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 98, normalized size of antiderivative = 2.51 \[ \int \frac {A+B x^2}{a-b x^2} \, dx=\left [-\frac {2 \, B a b x - {\left (B a + A b\right )} \sqrt {a b} \log \left (\frac {b x^{2} + 2 \, \sqrt {a b} x + a}{b x^{2} - a}\right )}{2 \, a b^{2}}, -\frac {B a b x + {\left (B a + A b\right )} \sqrt {-a b} \arctan \left (\frac {\sqrt {-a b} x}{a}\right )}{a b^{2}}\right ] \]

[In]

integrate((B*x^2+A)/(-b*x^2+a),x, algorithm="fricas")

[Out]

[-1/2*(2*B*a*b*x - (B*a + A*b)*sqrt(a*b)*log((b*x^2 + 2*sqrt(a*b)*x + a)/(b*x^2 - a)))/(a*b^2), -(B*a*b*x + (B
*a + A*b)*sqrt(-a*b)*arctan(sqrt(-a*b)*x/a))/(a*b^2)]

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 75 vs. \(2 (34) = 68\).

Time = 0.15 (sec) , antiderivative size = 75, normalized size of antiderivative = 1.92 \[ \int \frac {A+B x^2}{a-b x^2} \, dx=- \frac {B x}{b} - \frac {\sqrt {\frac {1}{a b^{3}}} \left (A b + B a\right ) \log {\left (- a b \sqrt {\frac {1}{a b^{3}}} + x \right )}}{2} + \frac {\sqrt {\frac {1}{a b^{3}}} \left (A b + B a\right ) \log {\left (a b \sqrt {\frac {1}{a b^{3}}} + x \right )}}{2} \]

[In]

integrate((B*x**2+A)/(-b*x**2+a),x)

[Out]

-B*x/b - sqrt(1/(a*b**3))*(A*b + B*a)*log(-a*b*sqrt(1/(a*b**3)) + x)/2 + sqrt(1/(a*b**3))*(A*b + B*a)*log(a*b*
sqrt(1/(a*b**3)) + x)/2

Maxima [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 49, normalized size of antiderivative = 1.26 \[ \int \frac {A+B x^2}{a-b x^2} \, dx=-\frac {B x}{b} - \frac {{\left (B a + A b\right )} \log \left (\frac {b x - \sqrt {a b}}{b x + \sqrt {a b}}\right )}{2 \, \sqrt {a b} b} \]

[In]

integrate((B*x^2+A)/(-b*x^2+a),x, algorithm="maxima")

[Out]

-B*x/b - 1/2*(B*a + A*b)*log((b*x - sqrt(a*b))/(b*x + sqrt(a*b)))/(sqrt(a*b)*b)

Giac [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 36, normalized size of antiderivative = 0.92 \[ \int \frac {A+B x^2}{a-b x^2} \, dx=-\frac {B x}{b} - \frac {{\left (B a + A b\right )} \arctan \left (\frac {b x}{\sqrt {-a b}}\right )}{\sqrt {-a b} b} \]

[In]

integrate((B*x^2+A)/(-b*x^2+a),x, algorithm="giac")

[Out]

-B*x/b - (B*a + A*b)*arctan(b*x/sqrt(-a*b))/(sqrt(-a*b)*b)

Mupad [B] (verification not implemented)

Time = 0.10 (sec) , antiderivative size = 31, normalized size of antiderivative = 0.79 \[ \int \frac {A+B x^2}{a-b x^2} \, dx=\frac {\mathrm {atanh}\left (\frac {\sqrt {b}\,x}{\sqrt {a}}\right )\,\left (A\,b+B\,a\right )}{\sqrt {a}\,b^{3/2}}-\frac {B\,x}{b} \]

[In]

int((A + B*x^2)/(a - b*x^2),x)

[Out]

(atanh((b^(1/2)*x)/a^(1/2))*(A*b + B*a))/(a^(1/2)*b^(3/2)) - (B*x)/b